import axios from 'axios'
const service = axios.create({
  baseURL: 'http://127.0.0.1:9000',
  timeout: 50000,
})
// 响应拦截
service.interceptors.response.use(
  response => {
    return response.data
  },
)
// 请求拦截
service.interceptors.request.use(
  (config) => {
    // 需要携带token给服务器
    if (localStorage.getItem('token')) {
      config.headers.Authorization = localStorage.getItem('token')
    }
    return config
  }
)
export default service